package com.dehui.traders.ui.stockdetail.adapter;

import android.content.Context;
import android.text.TextUtils;

import com.dehui.traders.R;
import com.dehui.traders.ui.stockdetail.bean.LabelTabel;
import com.dehui.traders.widgets.BaseViewHolder;
import com.dehui.traders.widgets.CommonAdapter;

import java.util.List;

public class LabelTabelAdapter extends CommonAdapter<LabelTabel>{


    public LabelTabelAdapter(Context context, List<LabelTabel> mDatas, int itemLayoutId) {
        super(context, mDatas, itemLayoutId);
    }

    @Override
    public void convert(BaseViewHolder helper, LabelTabel item, int position) {
        helper.setText(R.id.tv_title,item.getDate());
        helper.setText(R.id.tv_tag,"1".equals(item.getLabel()) ? "卖":"买");
        helper.setSelect(R.id.tv_tag,"1".endsWith(item.getLabel()));
        String msg = item.getPrice() + ("1".equals(item.getLabel()) ? " 卖出 ":" 买入 ") + "收益:" + (TextUtils.isEmpty(item.getDifferencePrice()) ? "0.00%" : item.getDifferencePrice());
        helper.setText(R.id.tv_content,msg);
    }
}
